package com.android.camera.processing.imagebackend;

import java.nio.ByteBuffer;
import java.util.concurrent.Executor;

import com.android.camera.debug.Log;
import com.android.camera.processing.memory.LruResourcePool;
import com.android.camera.session.CaptureSession;
import com.android.camera.util.Size;

public class TaskRGBPreviewChainedJpeg  extends TaskConvertImageToRGBPreview {
    private final static Log.CTag TAG = new Log.CTag("TaskPreviewChainedJpeg");
    private final LruResourcePool<Integer, ByteBuffer> mByteBufferDirectPool;

    TaskRGBPreviewChainedJpeg(ImageToProcess image,
            Executor executor,
            ImageTaskManager imageTaskManager,
            CaptureSession captureSession,
            Size targetSize,
            LruResourcePool<Integer, ByteBuffer> byteBufferResourcePool) {
        super(image, executor, imageTaskManager, ProcessingPriority.AVERAGE, captureSession,
                targetSize , ThumbnailShape.SQUARE_ASPECT_CIRCULAR_INSET);
        mByteBufferDirectPool = byteBufferResourcePool;
    }

    public void logWrapper(String message) {
        Log.v(TAG, message);
    }
    
    @Override
    public void onRunning() {
    	logWrapper("TIMER_END TaskRGBPreviewChainedJpeg onRunning");
    	TaskImageContainer jpegTask = new TaskCompressImageToJpeg(mImage, mExecutor,
                mImageTaskManager, mSession, mByteBufferDirectPool);
        mImageTaskManager.appendTasks(mImage, jpegTask);
    }
}
